package com.example.gulimall.product.feign;

import com.example.common.to.SkuReductionTo;
import com.example.common.to.SpuBoundsTo;
import com.example.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * <p>
 *
 * </p>
 *
 * @author zyred
 * @since v 0.1
 **/
@FeignClient("gulimall-coupon")
public interface CouponFeignService {

    /**
     * spring cloud 远程调用逻辑
     * 1. 讲 SpuBoundsTo 转换为 json
     * 2. 在注册中心中找到 gulimall-coupon 服务，给接口 /coupon/spubounds/save 发送请求，讲 json 放到请求体中
     * 3. 对方服务收到情况体中 json 数据
     * 4. 对方服务将 json 转换为对应的实体
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundsTo spuBoundsTo);


    @PostMapping("/coupon/skufullreduction/saveReductionInfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
